/*
 * @Author: 胡海
 * @Date: 2020-04-02 21:13:04
 * @LastEditors: 胡海
 * @LastEditTime: 2020-04-06 22:47:31
 * @Description: 
 */
const db = wx.cloud.database()
Page({
  data: {
    userinfo: {},
    // 被收藏的商品的数量
    collectNums: 0
  },
  onShow() {
    this._shouChang()
    const userinfo = wx.getStorageSync("userinfo");
    const collect = wx.getStorageSync("collect") || [];

    this.setData({
      userinfo,
      collectNums: collect.length
    });

  },
  _shouChang() {
    db.collection('shouChang')
      .get()
      .then((res) => {
        this.setData({
          collectNums: res.data.length
        })
      })
  },
  myOrder: function (e) { // 我的订单
    wx.navigateTo({
      url: '../myOrder/myOrder'
    })
  },
  shouChang:function(e){// 收藏页
    wx.navigateTo({
      url: '../shouChang/shouChang'
    })
  }
})